package cn.jolyoulu.common.web.excption;


import cn.jolyoulu.common.web.enums.GlobalExpType;
import cn.jolyoulu.common.web.enums.IExpType;
import lombok.Getter;

/**
 * @Author: JolyouLu
 * @Date: 2023/1/19 16:16
 * @Version 1.0
 */
@Getter
public class GlobalException extends RuntimeException{

    /**
     * 异常code
     */
    private int code;
    /**
     * 异常信息
     */
    private String message;

    public GlobalException(int code,String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public GlobalException(IExpType iExpType) {
        super(iExpType.msg());
        this.code = iExpType.code();
        this.message = iExpType.msg();
    }
}
